Introducction to Shiny

Cristian Suarez Vera
29-05-2020

image

What is Shiny?

  • R framework
  • Easy to use for data scientis because is a know language R
  • Can generate Apps easy

logo

What is R?

R is a programing language and free sofware environment for statistical computing

colnames(titanic)
 [1] "PassengerId" "Survived"    "Pclass"      "Name"        "Sex"        
 [6] "Age"         "SibSp"       "Parch"       "Ticket"      "Fare"       
[11] "Cabin"       "Embarked"   

What is R?

R is a programing language and free sofware environment for statistical computing

summary(titanic$Age)
   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.    NA's 
   0.42   20.12   28.00   29.70   38.00   80.00     177 

What is R?

R is a programing language and free sofware environment for statistical computing

womenFirstClass <- titanic[titanic$Sex == "female" & titanic$Pclass == 1, c("Name")]
head(womenFirstClass, 5)
[1] Cumings, Mrs. John Bradley (Florence Briggs Thayer)
[2] Futrelle, Mrs. Jacques Heath (Lily May Peel)       
[3] Bonnell, Miss. Elizabeth                           
[4] Spencer, Mrs. William Augustus (Marie Eugenie)     
[5] Harper, Mrs. Henry Sleeper (Myna Haxtun)           
891 Levels: Abbing, Mr. Anthony ... Zimmerman, Mr. Leo

Shiny sample

Share a Shiny project

  • Shiny project
  • HTML, PDF
  • Shiny hosting
  • Our Shiny server

Applications

Other stuff with R

  • Knit
  • Presentations
  • Dinamic papers

Is posisible to use react a shiny application?

As we can read on this article on the 2019 Rstudio conf they talk about reactR package

On the example block in the readme of this project we can read some code on how to use the library.

It looks that is on an early dev phase now.

library(reactR)
library(htmltools)

browsable(tagList(
  tags$div(id = "app"),
  tags$script(
  "
    ReactDOM.render(
      React.createElement(
        'h1',
        null,
        'Powered by React'
      ),
      document.getElementById('app')
    )
  "
  ),
  #add core-js first to work in RStudio Viewer
  html_dependency_corejs(),
  html_dependency_react()
))